﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using DiscoveryLogic.Analytics.DataObjects;
using DiscoveryLogic.Analytics.DataObjects.Networks;
using DiscoveryLogic.Analytics.Diagrams.Physics;
using DiscoveryLogic.Common.Utilities;
using Microsoft.Practices.Composite.Modularity;
using Microsoft.Practices.Composite.Regions;
using Microsoft.Practices.Composite.Wpf.Commands;
using Microsoft.Practices.Unity;
using EntityBase=DiscoveryLogic.Analytics.DataObjects.EntityBase;

namespace DiscoveryLogic.Analytics.Diagrams.NetworkGraphs
{
	#region eventargs
	public class GrantEventArgs:RoutedEventArgs
	{
		private GrantDO _Grant;
		/// <summary></summary>
		public GrantDO Grant
		{
			get
			{
				return this._Grant;
			}
			set
			{
				this._Grant = value;
			}
		}

		public GrantEventArgs(RoutedEvent routedEvent, GrantDO grant):base(routedEvent)
		{
			this._Grant = grant;
		}
	}

	public class PersonEventArgs:RoutedEventArgs
	{
		private PersonDO _Person;
		/// <summary></summary>
		public PersonDO Person
		{
			get
			{
				return this._Person;
			}
			set
			{
				this._Person = value;
			}
		}

		public PersonEventArgs(RoutedEvent routedEvent, PersonDO person):base(routedEvent)
		{
			this._Person = person;
		}
	}

	public class OrganizationEventArgs:RoutedEventArgs
	{
		private ExternalOrgDO _Org;
		/// <summary></summary>
		public ExternalOrgDO Org
		{
			get
			{
				return this._Org;
			}
			set
			{
				this._Org = value;
			}
		}

		public OrganizationEventArgs(RoutedEvent routedEvent, ExternalOrgDO org):base(routedEvent)
		{
			this._Org = org;
		}
	}

	public class PublicationEventArgs : RoutedEventArgs
	{
		private PublicationDO _Publication;
		/// <summary></summary>
		public PublicationDO Publication
		{
			get
			{
				return this._Publication;
			}
			set
			{
				this._Publication = value;
			}
		}

		public PublicationEventArgs(RoutedEvent routedEvent, PublicationDO pub)
			: base(routedEvent)
		{
			this._Publication = pub;
		}
	}
	#endregion

	public class NetworkViewModule : IModule 
	{
		#region props
		public IUnityContainer Container { get; private set; }
		public IRegionManager RegionManager { get; private set; }
		#endregion

		#region ctor
		public NetworkViewModule(IUnityContainer container, IRegionManager regionManager)
		{
			Container = container;
			RegionManager = regionManager;
		}
		#endregion


		#region Implementation of IModule

		public void Initialize()
		{
            NetworkGraphView graphView = Container.Resolve<NetworkGraphView>();
			RegionManager.Regions["NetworkGraphRegion"].Add(graphView);
            RegionManager.Regions["NetworkGraphRegion"].Activate(graphView);
            graphView.SubscribeEventHandler(null);
            graphView.SubscribeViewGraphEventHandler(null);
		}
		#endregion
	}
}
